package cn.edu.scnu.semart.cart.mapper;

import cn.edu.scnu.semart.model.cart.Cart;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface CartMapper extends BaseMapper<Cart> {
    // 自定义查询方法
/*    Cart selectByUserAndProduct(@Param("userId") Integer userId,
                                @Param("productId") Integer productId);*/

    List<Cart> selectByUserId(Integer userId);

    @Delete("<script>" +
            "DELETE FROM cart WHERE cart_id IN " +
            "<foreach item='id' collection='ids' open='(' separator=',' close=')'>" +
            "#{id}" +
            "</foreach>" +
            "</script>")
    int deleteBatchIds(@Param("ids") List<Integer> ids);  // 添加 @Param 注解
}